<?php
namespace app\center\logic;

class RemarkLogic extends BaseLogic {

    /**
     * 获取备注查询条件
     * @param $openid
     * @param $branchid
     * @param $floorid
     * @param $regionid
     * @param $start_time
     * @param $end_time
     * @return array
     */
    public function get_search_remark_maps($openid,$branchid,$floorid,$regionid,$start_time,$end_time){
        $maps = [];
        $maps[] = ['openid','=',$openid];
        $maps[] = ['remark','<>',''];

        if($branchid != -1){
            $maps[] = ['branchid','=',$branchid];
        }

        if($floorid != -1){
            $maps[] = ['floorid','=',$floorid];
        }

        if($regionid != -1){
            $maps[] = ['regionid','=',$regionid];
        }

        if(!empty($start_time) && !empty($end_time)){
            $maps[] = ['c_time','between',[$start_time . ' 00:00:00',$end_time . ' 23:59:59']];
        }else{
            if(!empty($start_time)){
                $maps[] = ['c_time','>=',$start_time . ' 00:00:00'];
            }
            if(!empty($end_time)){
                $maps[] = ['c_time','<=',$end_time . ' 23:59:59'];
            }
        }
        return $maps;
    }
}